Selecting traces





If more than one y-vector argument was given to plt, a trace selection box will appear in the upper left corner of the plt window. Note: when using sub-plots, only the main plot (lower left) includes a trace selection box. (Note: sometimes I call this the TraceID box).

In the example shown to the left, plt has been given five y-vectors to plot. The name of each trace and the colors used to plot them are also given. Usually, you should give each trace a more informative name, but in this case, no trace names were specified on the command line, so plt just named each trace with a number. The trace IDs associated with traces 2 and 3 are shown in italics, indicating that they are currently disabled (not visible). The other three trace IDs are shown in a bold upright font, indicating that those traces are enabled in the plot area.

Below is a list of the ways you can control which traces are displayed. If you are plotting just a few traces, the first bullet should cover all that you need to know. However since plt can plot up to 99 traces, the remaining tricks may come in handy:
The default trace color order used by plt (shown in this figure) is quite different from Matlab's usual default in that it allows you to distinguish many traces based on color alone. Since the color used for the trace IDs match the color of the corresponding trace, you can easily identify each trace by name for plots with a dozen or so traces and perhaps even many times that amount depending on the acuity of your color perception. Read more about this in the Default colors section If you have any doubt about the name of a particular trace, simply click on the trace, and its trace ID will appear in the "cursor ID" tag just to the left of the y-axis cursor readout. (See "Cursoring" on the next page). Another way to verify the name of a trace is to click on the name of the trace in the trace ID box. As mentioned above, the corresponding trace will become invisible and then restored when you click on the trace ID a second time. To see the list of RGB triples used to generate this default color order, see the description of the TRACEc parameter. Note that only the colors for traces 1 thru 40 are defined by this array. The defaults for lines 41 to 80 are the same as the colors listed above for lines 1 to 40 except that they are 26% dimmer. The defaults for the lines 81 to 99 are again 26% dimmer than the trace colors for lines 41 to 59.


If the plot uses a right-hand axis, plt indicates which traces are plotted on the right-hand axis by adding some shading to the background of the trace ID. For instance, in this example, traces 1,3,4, and 5 are plotted on the right-hand axis. The use of italics to indicate inactive traces and the methods for enabling/disabling traces are the same no matter which axes are used. (Traces 2 and 4 are disabled in this example.)

If the TraceMK argument was used, then the line types are also shown in the trace selection box. An example of this is shown here which used 'TraceMK',.6 in the plt argument list. The .6 indicates that the first 60% of the width is used for the trace names and the remaining width is used to show the line types. See the Trace Properties section for more detail on the TraceMK parameter.

When the line types are included in the trace selection box, you may enable/disable traces by clicking on the trace name as described above, or by clicking on the line type to the right of the trace name. In this example traces 3,4 and 5 have been disabled. The trace names for the disabled traces are shown in italics as usual and the line types are also grayed out (actually blue/green) to make it clear that these traces are not currently visible in the plot area.

Since left or right clicking on the line types serves the same purpose as left/right clicking on the trace names, you can dispense with the trace names altogether if you like. (This mode is selected by specifying assigning less than 25% of the width of the trace names, i.e. a TraceMK parameter of less than .25). In the example to the left, the TraceMK parameter was 0.1 and note that the first trace has been disabled.